<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
    <title>Document</title>
</head>
<body>
        <form action="">
        <input id="email" name="email" type="text" placeholder="请输入账号">
        <br>
        <input id="psw" name="psw" type="text" placeholder="请输入密码">
        <br>
        <input id="again" name="again" type="text" placeholder="重复输入">
        <br>
        <button>注册</button>
    </form>
    <script>
        $('form').on('submit',function(e){
            e.preventDefault()
            console.log('阻止拉默认事件')
            if($('#psw').val()==0 ||$('#email').val()==0){
                alert('账号密码不能为空')
                return
            }
            if($('#psw').val()!=$('#again').val()){
                alert('两次密码不一致')
                return
            }
            $.post('/regist',$('form').serialize(),function(data){
                
            })
        })
        
        
    </script>
</body>
</html>